window.onload=()=>{
    let nameArr=[]
    if(localStorage.nameArr==null)localStorage.nameArr='[]'
    else nameArr=JSON.parse(localStorage.nameArr);

    let l=nameArr.length;
    let list=$('list');
    list.innerHTML=''
    for(let i=0;i<l;i++){
        list.innerHTML+=`<a href="content.html?${i}"><li id="${i}">${nameArr[i]}</li></a>`
    }
}

function add(){
    let nameArr=JSON.parse(localStorage.nameArr);
    let l=nameArr.length
    nameArr[l]='Untitled';
    localStorage.nameArr=JSON.stringify(nameArr)
    window.location.href = 'content.html?'+l;
}